package com.xiaoxie.mapper;

import com.xiaoxie.entity.learnLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface learnLogDao {
    @Insert("insert into learn_log values (null,#{id},now(),0,#{reviewNumber},0,0,0,0)")
    void insert(Integer id, Integer reviewNumber);

    @Select("select * from learn_log where userid=#{id} order by date desc ")
    List<learnLog> getALl(Integer id);

    @Update("update learn_log set insert_word=insert_word+1 where userid=#{id} and DATE(date) = CURDATE()")
    void udInsert(Integer id);
    @Update("update learn_log set learn_sum=learn_sum+1, `right`=`right`+1 where userid=#{id} and DATE(date) = CURDATE()")
    void udright(Integer id);
    @Update("update learn_log set learn_sum=learn_sum+1, wrong=wrong+1 where userid=#{id} and DATE(date) = CURDATE()")
    void udwrong(Integer id);

    @Update("update learn_log set learn_sums=learn_sums+1 where userid=#{id} and DATE(date) = CURDATE()")
    void upsum(Integer id);
}

